package com.whimscrew.dept.controller;

import com.whimscrew.dept.model.Dept;
import com.whimscrew.dept.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/v2/dept")
public class V2DeptController {


    @Autowired
    private DeptService deptService;

    @Value("${config.text}")
    private String configText;

    @Value("${server.port}")
    private String serverPort;

    @PostMapping
    public Dept save(@RequestParam String userName){
        return deptService.save(userName);
    }


    @GetMapping
    public String getDeve() {
        return "v2dept ==== "+serverPort+" ：" +configText;
    }

}
